package org.jsserv.resource;

import java.io.IOException;
import java.net.URL;

public abstract class URLResourceHolder<T>
{
    private URL url;
    private T content;
    
    public URLResourceHolder(URL url)
    {
        this.url=url;
    }
    
    public URL getURL()
    {
        return url;
    }

    public synchronized T getContent() throws IOException
    {
        if (content != null)
            return content;
                
        return content=createContent();
    }
    
    public abstract T createContent() throws IOException;
    
}
